<template>
    <div class="container-personnel">
        <div class="search-filter">
            <el-row :gutter="20">
                <el-col :span="6">
                    <sitem label="应聘职位：">
                        <el-input
                            slot="item"
                            v-model="listQuery.jobName"
                            placeholder="请输入关键字"
                            @input="listQuery.jobId = ''"
                        />
                    </sitem>
                </el-col>
                <el-col :span="6">
                    <sitem label="求职者：">
                        <el-input
                            slot="item"
                            v-model="listQuery.userName"
                            placeholder="请输入关键字"
                        />
                    </sitem>
                </el-col>
                <el-col v-if="!components" :span="6">
                    <sitem label="简历状态：">
                        <el-select
                            slot="item"
                            v-model="listQuery.state"
                            placeholder="请选择"
                            clearable
                        >
                            <el-option
                                v-for="item in resumeHandler"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value"
                            />
                        </el-select>
                    </sitem>
                </el-col>
                <el-col v-if="components" :span="6">
                    <sitem label="职位发布源：">
                        <el-select
                            slot="item"
                            v-model="listQuery.source"
                            clearable
                            placeholder="请选择"
                        >
                            <el-option label="平台发布-普通职位" value="1"/>
                            <el-option label="平台发布-专场职位" value="2"/>
                            <el-option label="企业发布" value="3"/>
                        </el-select>
                    </sitem>
                </el-col>
                <!-- <el-col :span="6">
                  <sitem label="最高学历：">
                    <el-select
                      slot="item"
                      v-model="listQuery.eduLevel"
                      placeholder="请选择"
                      clearable
                    >
                      <el-option
                        v-for="item in eduLevels"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      />
                    </el-select>
                  </sitem>
                </el-col> -->
                <el-col :span="6">
                    <sitem label="工作年限：">
                        <el-select
                            slot="item"
                            v-model="listQuery.workYear"
                            clearable
                            placeholder="请选择"
                        >
                            <el-option
                                v-for="item in experience"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value"
                            />
                        </el-select>
                    </sitem>
                </el-col>
                <el-col v-if="components" :span="6">
                    <sitem label="应聘时间：">
                        <el-select
                            slot="item"
                            v-model="listQuery.timeState"
                            clearable
                            placeholder="请选择"
                        >
                            <el-option label="近3个月" value="0"/>
                            <el-option label="近半年" value="1"/>
                        </el-select>
                    </sitem>
                </el-col>

                <el-col v-if="listQuery.state == 4" :span="6">
                    <sitem label="面试联系人：">
                        <el-input
                            slot="item"
                            v-model="listQuery.conName"
                            placeholder="请输入关键字"
                        />
                    </sitem>
                </el-col>

                <el-col v-if="listQuery.state == 5" :span="6">
                    <sitem label="入职联系人：">
                        <el-input
                            slot="item"
                            v-model="listQuery.conName"
                            placeholder="请输入关键字"
                        />
                    </sitem>
                </el-col>
                <el-col :span="6">
                    <sitem>
                        <el-button
                            slot="item"
                            type="primary"
                            icon="el-icon-search"
                            @click="pageInitList(null)"
                        >查询
                        </el-button>
                    </sitem>
                </el-col>
            </el-row>
        </div>
        <div class="content">
            <div class="table-top-group">
                <div>
                    <div class="item mr30">
                        <el-checkbox v-model="isCheckAll" :indeterminate="isCheckAllStyle" @change="checkAllDataChange">
                            全选
                        </el-checkbox>
                    </div>
                    <div class="item mr20">
                        <el-button icon="el-icon-share" type="success" @click="selectedForwardDrawerOpen">转发同事
                        </el-button>
                    </div>
                    <div class="item">
                        <el-button type="primary" icon="el-icon-download" :loading="downloadLoading" @click="download">
                            导出简历
                        </el-button>
                    </div>
                    <div class="item ml20">
                        <el-button type="warning" :loading="downloadExcelLoading" icon="el-icon-user"
                                   @click="exportExcel">导出名单
                        </el-button>
                    </div>
                </div>
            </div>
            <div v-loading="listLoading" class="list">
                <el-checkbox-group v-model="checkedData" @change="checkedDataChange">
                    <div v-for="(item, index) in list" :key="index" class="box-item">
                        <div class="upper">
                            <span><el-checkbox :label="item">{{ '' }}</el-checkbox></span>
                            <span>应聘岗位：{{ item.jobName }}</span>
                            <span> 应聘时间：{{
                                    $moment(item.jobTime).format(
                                        'yyyy年MM月DD日 HH:mm'
                                    )
                                }}</span>

                            <!-- <span>{{item.enInfo.enName}}</span> -->
                        </div>

                        <el-card class="mb15 type-tag-view">
                            <div class="type-tag">
                                <el-tag
                                    v-if="item.sysFrom == 1 && components"
                                    type="warning"
                                    effect="dark"
                                    size="mini"
                                    class="mr10"
                                >企业发布
                                </el-tag>
                                <el-tag
                                    v-if="item.sysFrom == 2 && components"
                                    type="danger"
                                    effect="dark"
                                    size="mini"
                                    class="mr10"
                                >平台发布
                                </el-tag>
                                <el-tag
                                    v-if="item.sysFrom == 2 && item.bsType == 0 && components"
                                    type="primary"
                                    effect="dark"
                                    size="mini"
                                    class="mr10"
                                >普通职位
                                </el-tag>
                                <el-tag
                                    v-if="item.sysFrom == 2 && item.bsType == 1 && components"
                                    type="success"
                                    effect="dark"
                                    size="mini"
                                    class="mr10"
                                >专场职位
                                </el-tag>
                                <el-tag
                                    style="border: 0"
                                    color="#f345b5"
                                    effect="dark"
                                    size="mini"
                                    class="mr10"
                                >{{ item.job.recruitType_dictText }}职位
                                </el-tag>
                            </div>
                            <div class="lower" :class="{'mt10':components}">
                                <div class="photo">
                                    <el-avatar :size="50" :src="item.userInfo.photoId_dictText"/>
                                </div>
                                <el-row :gutter="20" class="info-box">
                                    <el-col :span="8">
                                        <div class="basic-info">
                                            <div class="name">
                        <span class="link-type" @click="openView(item)">{{
                                item.userInfo ? item.userInfo.name : ''
                            }}</span>
                                                <el-tag
                                                    v-if="item.deliveryHistory.state == 0 || item.deliveryHistory.state == 1"
                                                    effect="plain"
                                                    size="mini"
                                                    class="ml10"
                                                >新简历
                                                </el-tag>
                                                <el-tag
                                                    v-if="item.deliveryHistory.state == 3"
                                                    type="success"
                                                    effect="plain"
                                                    size="mini"
                                                    class="ml10"
                                                >初筛
                                                </el-tag>

                                                <el-popover
                                                    v-if="item.deliveryHistory.state == 4"
                                                    placement="right"
                                                    width="500"
                                                    trigger="click"
                                                >
                                                    <div>
                                                        <span class="f16 fb">面试信息</span>
                                                        <span
                                                            v-if="
                                item.opInterviewHistory.length > 0 &&
                                  item.opInterviewHistory[0].outLineState == 0
                              "
                                                            class="ml20 text-warning"
                                                        >待处理</span>
                                                        <span
                                                            v-if="
                                item.opInterviewHistory.length > 0 &&
                                  item.opInterviewHistory[0].outLineState == 1
                              "
                                                            class="ml20 text-warning"
                                                        >对方已接受</span>
                                                        <span
                                                            v-if="
                                item.opInterviewHistory.length > 0 &&
                                  item.opInterviewHistory[0].outLineState == 2
                              "
                                                            class="ml20 text-warning"
                                                        >对方已拒绝</span>
                                                    </div>
                                                    <div class="mt10 ml20">
                                                        <div class="">
                                                            <span>面试职位：</span>
                                                            <span>{{ item.jobName }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>面试形式：</span>
                                                            <span
                                                                v-if="
                                  item.opInterviewHistory.length > 0 &&
                                    item.opInterviewHistory[0].type == 0
                                "
                                                            >现场面试</span>
                                                            <span
                                                                v-if="
                                  item.opInterviewHistory.length > 0 &&
                                    item.opInterviewHistory[0].type == 1
                                "
                                                            >视频面试</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>面试时间：</span>
                                                            <span>{{
                                                                    item.opInterviewHistory.length > 0
                                                                        ? item.opInterviewHistory[0].time
                                                                        : ''
                                                                }}</span>
                                                            <span
                                                                v-if="
                                  item.opInterviewHistory.length > 0 &&
                                    item.opInterviewHistory[0].interviewEndTime
                                "
                                                            >
                                -
                                {{
                                                                    item.opInterviewHistory.length > 0
                                                                        ? item.opInterviewHistory[0]
                                                                            .interviewEndTime
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>联&#8194;系&#8194;人：</span>
                                                            <span>{{
                                                                    item.opInterviewHistory.length > 0
                                                                        ? item.opInterviewHistory[0].contact.userName
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>联系电话：</span>
                                                            <span>{{
                                                                    item.opInterviewHistory.length > 0
                                                                        ? item.opInterviewHistory[0].contact.phone
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>备注信息：</span>
                                                            <span>{{
                                                                    item.opInterviewHistory.length > 0
                                                                        ? item.opInterviewHistory[0].remark
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                        <div v-if="item.opInterviewHistory.length > 0" class="mt5">
                                                            <span>面试官：</span>
                                                            <span v-for="(c, i) in item.opInterviewHistory[0].conInfo"
                                                                  :key="i">
                                {{ c.name }}<span v-if="i<item.opInterviewHistory[0].conInfo.length-1">，</span>
                              </span>
                                                        </div>
                                                    </div>
                                                    <el-button
                                                        slot="reference"
                                                        type="text"
                                                        size="mini"
                                                        class="ml15 p0"
                                                    >面试信息 <i
                                                        class="el-icon-arrow-right"
                                                    /></el-button>
                                                </el-popover>

                                                <el-popover
                                                    v-if="
                            item.deliveryHistory.state == 5 ||
                              item.deliveryHistory.state == 6
                          "
                                                    placement="right"
                                                    width="500"
                                                    trigger="click"
                                                >
                                                    <div>
                                                        <span class="f16 fb">录用信息</span>
                                                        <!-- <span
                                                          v-if="item.deliveryHistory.state == 5"
                                                          class="ml20 text-warning"
                                                          >已录用</span
                                                        >
                                                        <span
                                                          v-if="item.deliveryHistory.state == 6"
                                                          class="ml20 text-warning"
                                                          >已入职</span
                                                        > -->
                                                    </div>
                                                    <div class="mt10 ml20">
                                                        <div class="">
                                                            <span>入职职位：</span>
                                                            <span>{{ item.jobName }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>入职时间：</span>
                                                            <span>{{
                                                                    item.entryHistory
                                                                        ? item.entryHistory.createTime
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span> 联&#8194;系&#8194;人 ：</span>
                                                            <span>{{
                                                                    item.entryHistory && item.entryHistory.contact
                                                                        ? item.entryHistory.contact.userName
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>联系电话：</span>
                                                            <span>{{
                                                                    item.entryHistory && item.entryHistory.contact
                                                                        ? item.entryHistory.contact.phone
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                        <div class="mt5">
                                                            <span>备注信息：</span>
                                                            <span>{{
                                                                    item.entryHistory
                                                                        ? item.entryHistory.remark
                                                                        : ''
                                                                }}</span>
                                                        </div>
                                                    </div>
                                                    <el-button
                                                        slot="reference"
                                                        type="text"
                                                        size="mini"
                                                        class="ml15 p0"
                                                    >录用信息 <i
                                                        class="el-icon-arrow-right"
                                                    /></el-button>
                                                </el-popover>
                                            </div>

                                            <div class="introduce">
                        <span>{{
                                item.userInfo
                                    ? item.userInfo.sex != 0
                                        ? item.userInfo.sex == 2
                                            ? '女'
                                            : '男'
                                        : '未知'
                                    : '未知'
                            }}</span>
                                                <span>{{
                                                        item.userInfo.age ? item.userInfo.age : (item.userInfo.birthday | calculationAge)
                                                    }} 岁</span>
                                                <span>{{
                                                        item.userInfo.liveCity_dictText
                                                            ? item.userInfo.liveCity_dictText.split(',')[1]
                                                            : '未知'
                                                    }}</span>
                                                <span>{{
                                                        item.userInfo.workYears > 0
                                                            ? item.userInfo.workYears + '年经验'
                                                            : '无工作经验'
                                                    }}</span>
                                            </div>

                                            <div
                                                v-if="
                          item.deliveryHistory.state < 4 &&
                            item.workIntention.length > 0
                        "
                                                class="expect clearfix"
                                            >
                                                <div class="expect-title">期望：</div>

                                                <div class="expect-box">
                                                    <div
                                                        v-for="(workIntention, index) in item.workIntention"
                                                        :key="index"
                                                        class="expect-item overflow-ellipsis"
                                                        :class="{mb5:index == 0}"
                                                    >
                                                        <template v-if="index < 2">
                              <span>{{
                                      workIntention.cityId_dictText
                                          ? workIntention.cityId_dictText.split(',')[1]
                                          : ''
                                  }}</span>
                                                            <span>{{
                                                                    workIntention.workNature_dictText
                                                                        ? workIntention.workNature_dictText.split(
                                                                            ','
                                                                        )[1]
                                                                        : ''
                                                                }}</span>
                                                            <span>{{
                                                                    parseFloat(workIntention.minMoney / 1000)
                                                                }}k -
                                {{
                                                                    parseFloat(workIntention.maxMoney / 1000)
                                                                }}k</span>
                                                        </template>
                                                    </div>
                                                </div>
                                            </div>
                                            <div v-if="item.deliveryHistory.state > 3">
                                                <span class="f14">手机号:</span>
                                                <span class="f14 ml20 text-999">{{
                                                        item.userInfo.phone
                                                    }}</span>
                                            </div>
                                        </div>
                                    </el-col>
                                    <el-col :span="8">
                                        <div class="history-info">
                                            <div v-if="item.workInfo&&item.workInfo.length > 0" class="work">
                                                <div class="icon">
                                                    <i class="el-icon-s-cooperation"/>
                                                </div>
                                                <div
                                                    v-for="(company, index) in item.workInfo"
                                                    :key="index"
                                                    class="item "
                                                    :class="{ mb5: index == 0 }"
                                                >
                                                    <template v-if="index < 2">
                                                        <div class="date ">
                                                            {{
                                                                $moment(
                                                                    company.workStartTime,
                                                                    'yyyy-MM-DD HH:mm:ss'
                                                                ).format('yyyy.MM')
                                                            }}-
                                                            {{
                                                                $moment(
                                                                    company.workEndTime,
                                                                    'yyyy-MM-DD HH:mm:ss'
                                                                ).format('yyyy.MM')
                                                            }}
                                                        </div>
                                                        <div class="company-item">
                                                            <span>{{ company.companyName }}</span>
                                                            <span>{{ company.positionName_dictText }}</span>
                                                        </div>
                                                    </template>
                                                </div>
                                            </div>
                                            <div
                                                v-if="item.eduInfo&&item.eduInfo.length > 0"
                                                class="education mt15"
                                            >
                                                <div class="icon"><i class="el-icon-school"/></div>
                                                <div class="item">
                                                    <div class="date">
                                                        {{
                                                            $moment(
                                                                item.eduInfo[0].startEduTime,
                                                                'yyyy-MM-DD HH:mm:ss'
                                                            ).format('yyyy.MM')
                                                        }}-
                                                        {{
                                                            $moment(
                                                                item.eduInfo[0].endEduTime,
                                                                'yyyy-MM-DD HH:mm:ss'
                                                            ).format('yyyy.MM')
                                                        }}
                                                    </div>
                                                    <div class="company-item">
                                                        <span>{{ item.eduInfo[0].schoolName }}</span>
                                                        <span>{{ item.eduInfo[0].major }}</span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </el-col>
                                    <el-col :span="8">
                                        <div v-if="item.sysFrom == 1&&resumeHandlerData[item.deliveryHistory.state]"
                                             class="button-group">
                                            <el-button
                                                v-for="(resumeData,index) in resumeHandlerData[item.deliveryHistory.state].children"
                                                :key="index"
                                                :disabled="item.deliveryHistory.state == 4&&item.opInterviewHistory.length > 0 && (item.opInterviewHistory[0].outLineState == 2 || !item.opInterviewHistory[0].timeFlag)"
                                                :type="searchButtonType(resumeData.value,1)"
                                                size="small"
                                                plain
                                                @click="buttonClick(resumeData.value,2,item)"
                                            >{{ resumeData.label }}
                                            </el-button>
                                        </div>
                                    </el-col>
                                </el-row>

                            </div>
                        </el-card>
                    </div>
                </el-checkbox-group>
            </div>
            <no-data v-if="noDateView"/>
        </div>
        <forward-drawer ref="forwardDrawer" @refresh="getList"/>
        <improper-drawer ref="improperDrawer" @refresh="getList"/>
        <employ-drawer ref="employDrawer" @refresh="getList"/>
        <interview-drawer ref="interviewDrawer" @refresh="getList"/>
        <interview-results-drawer ref="interviewResultsDrawer" @refresh="getList"/>
        <pagination
            v-show="total > 0"
            :total="total"
            prev-text="上一页"
            next-text="下一页"
            :page-sizes="[5, 10, 20, 50,100]"
            layout="prev, pager, next, sizes, jumper"
            :page.sync="listQuery.pageNo"
            :limit.sync="listQuery.pageSize"
            page-background="none"
            @pagination="getList"
        />
        <pdf-dialog ref="pdfDialog" @transportShow="transportShow"/>
    </div>
</template>

<script>
import PdfDialog from '@/components/PdfDialog'
import {userList} from '@/api/special-session'
import sitem from '@/components/searchItem'
import {editState, candidateList} from '@/api/personnel'
import {calculationAge} from '@/utils/index'
import {downloadResumeresumeByReId} from '@/api/common'
import {exportFile} from '@/utils/export'
import {mapState} from 'vuex'
import store from '@/store'
import noData from '@/components/noData'
import {excelGetUserListInfo} from '@/api/talent-pool'
import Pagination from '@/components/Pagination' // 分页
import forwardDrawer from '@/components/CurriculumVitaeStateDrawer/forwardDrawer'
import improperDrawer from '@/components/CurriculumVitaeStateDrawer/improperDrawer'
import employDrawer from '@/components/CurriculumVitaeStateDrawer/employDrawer'
import interviewDrawer from '@/components/CurriculumVitaeStateDrawer/interviewDrawer'
import interviewResultsDrawer from '@/components/CurriculumVitaeStateDrawer/interviewResultsDrawer'

export default {
    name: 'Personnel',
    components: {
        forwardDrawer,
        improperDrawer,
        employDrawer,
        interviewDrawer,
        Pagination,
        interviewResultsDrawer,
        noData,
        sitem,
        PdfDialog
    },
    props: {
        specialSessionId: {
            type: String,
            default: ''
        },
        components: { //  true简历库使用
            type: Boolean,
            default: false
        },
        state: {
            type: String,
            default: ''
        },
        jobId: {
            type: String,
            default: ''
        },
        jobName: {
            type: String,
            default: ''
        }
    },
    data() {
        return {
            total: 1,
            list: [],
            downloadLoading: false,
            downloadExcelLoading: false,
            noDateView: false,
            listLoading: false,
            checkedData: [], // 选中标识数组
            checkboxData: [], // 多选框标识数组
            isCheckAll: false, // 是否全选
            isCheckAllStyle: false, // 是否样式
            listQuery: {
                pageNo: 1,
                pageSize: 5,
                state: this.state,
                jobId: this.jobId,
                jobName: this.jobName,
                userName: '',
                eduLevel: '',
                workYear: '',
                timeState: '',
                type: '',
                ssId: this.specialSessionId
            }
        }
    },
    computed: {
        ...mapState({
            experience: (state) => state.app.experience, // 经验限制
            resumeHandler: (state) => state.app.resumeHandler, // 经验限制
            eduLevels: (state) => state.app.eduLevels, // 经验限制
            resumeHandlerData: (state) => state.app.resumeHandlerData
        })
    },
    filters: {
        calculationAge(e) {
            return calculationAge(e)
        }
    },
    // 生命周期 - 创建完成（可以访问当前this实例）
    created() {
        this.getList()
    },
    // 生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {
    },
    // 销毁
    destroyed() {
    },
    // 方法
    methods: {
        exportExcel() {
            this.downloadExcelLoading = true
            const query = {...this.listQuery}
            if (query.workYear) {
                const workYear = query.workYear.split(',')
                query.minWorkYear = workYear[0]
                query.maxWorkYear = workYear[1]
            } else {
                query.minWorkYear = ''
                query.maxWorkYear = ''
            }
            if (query.source) {
                switch (query.source) {
                    case '1':
                        query.sysFrom = 2
                        query.bsType = 0
                        break
                    case '2':
                        query.sysFrom = 2
                        query.bsType = 1
                        break
                    case '3':
                        query.sysFrom = 1
                        break

                    default:
                        console.log(111)
                        break
                }
            } else {
                query.sysFrom = ''
                query.bsType = ''
            }
            if (this.components) {
                if (!query.state) {
                    query.state = 0
                }
            }
            const checkedData = this.checkedData
            if (checkedData.length > 0) {
                const arr = []
                checkedData.forEach((i) => {
                    arr.push(i.dataId)
                })
                query.dataId = arr.join(',')
            }
            excelGetUserListInfo(query).then(response => {
                this.downloadExcelLoading = false
                window.open(`${process.env.VUE_APP_BASE_API}/en/enExcel/exportData?id=${response.result}`)
            })
        },
        openView(item) {
            item
            item.resumeId = item.reId
            item.type = item.cvResumeList[0].type
            item.lanType = item.cvResumeList[0].lanType
            item.jobInfo = {
                jobName: item.jobName
            }
            this.$refs.pdfDialog.show(item, true)
        },
        // 打开转发简历弹窗
        transportShow(e) {
            this.$refs.forwardDrawer.show(e.name, e.jobName, e.reId, e.jobId)
        },
        buttonClick(value, type, item) {
            const data = this.searchButtonType(value, type)
            const key = data.key
            item.updateState = data.value
            if (key == 'lose') {
                // 不合适
                this.improperDrawerOpen(item)
            }
            if (key == 'interviewForm') {
                // 面试
                this.interviewrDrawerOpen(item)
            }
            if (key == 'employForm') {
                // 录用
                this.employDrawerOpen(item)
            }
            if (key == 'feedbackForm') {
                // 反馈面试结果
                this.interviewResultsOpen(item)
            }
            if (key == 'success') {
                // 已入职
                this.editState(item.dataId, data.value, true)
            }
            if (key == 'absent') {
                // 未入职
                this.editState(item.dataId, data.value, false)
            }
            if (key == 'pass') {
                // 通过初筛
                this.$confirm('确定通过初次筛选吗?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    editState({
                        dataId: item.dataId,
                        state: data.value
                    }).then((res) => {
                        this.getList()
                        this.$message({
                            message: '操作成功',
                            type: 'success'
                        })
                    })
                }).catch(res => {

                })
            }
        },
        // 查询button样式
        searchButtonType(v, type) {
            let data
            const resumeHandler = this.resumeHandler
            resumeHandler.forEach(item => {
                if (item.value == v) {
                    if (type === 1) {
                        data = item.btnType
                    } else if (type === 2) {
                        data = {
                            value: item.value,
                            key: item.btnKey
                        }
                    }
                }
            })
            return data
        },
        editState(id, state) {
            this.$confirm('确定' + (state == 6 ? '已' : '未') + '入职吗?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                editState({
                    dataId: id,
                    state: state
                }).then(res => {
                    this.getList()
                    this.$message({
                        message: '操作成功',
                        type: 'success'
                    })
                })
            })
        },
        // 导出简历
        download() {
            const query = {...this.listQuery}
            if (query.workYear) {
                const workYear = query.workYear.split(',')
                query.minWorkYear = workYear[0]
                query.maxWorkYear = workYear[1]
            } else {
                query.minWorkYear = ''
                query.maxWorkYear = ''
            }
            if (query.source) {
                switch (query.source) {
                    case '1':
                        query.sysFrom = 2
                        query.bsType = 0
                        break
                    case '2':
                        query.sysFrom = 2
                        query.bsType = 1
                        break
                    case '3':
                        query.sysFrom = 1
                        break

                    default:
                        console.log(111)
                        break
                }
            } else {
                query.sysFrom = ''
                query.bsType = ''
            }
            if (this.components) {
                if (!query.state) {
                    query.state = 0
                }
            }
            const checkedData = this.checkedData
            if (checkedData.length > 0) {
                const arr = []
                checkedData.forEach((i) => {
                    arr.push(i.dataId)
                })
                query.dataId = arr.join(',')
            }
            excelGetUserListInfo(query).then(response => {
                window.open(`${process.env.VUE_APP_BASE_API}/en/download/resume/export?secret=${response.result}`)
            })
        },
        // 通过筛选
        passScreen(dataId) {
            this.$confirm('确定通过筛选吗?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                editState({
                    dataId: dataId,
                    state: 3
                }).then(res => {
                    this.getList()
                    this.$message({
                        message: '操作成功',
                        type: 'success'
                    })
                })
            })
        },
        checkAllDataChange(val) {
            if (this.isCheckAllStyle) {
                this.checkedData = this.list
                this.isCheckAllStyle = false
                this.isCheckAll = true
            } else {
                if (val) {
                    this.checkedData = this.list
                    this.isCheckAll = true
                    this.isCheckAllStyle = false
                } else {
                    this.checkedData = []
                    this.isCheckAllStyle = false
                    this.isCheckAll = false
                }
            }
        },
        checkedDataChange(value) {
            if (value.length == 0) {
                this.isCheckAll = false
                this.isCheckAllStyle = false
            } else if (value.length == this.list.length) {
                this.isCheckAll = true
                this.isCheckAllStyle = false
            } else if (value.length != this.list.length) {
                this.isCheckAllStyle = true
                this.isCheckAll = false
            }
        },
        tabComponentsState(state) {

        },
        pageInitList(state) {
            if (state) {
                this.listQuery.state = state
            }
            this.listQuery.pageNo = 1
            this.getList()
        },
        getList() {
            this.listLoading = true
            this.checkedData = [] // 选中标识数组
            this.checkboxData = [] // 多选框标识数组
            this.isCheckAll = false // 是否全选
            this.isCheckAllStyle = false // 是否样式
            const query = {...this.listQuery}
            if (query.workYear) {
                const workYear = query.workYear.split(',')
                query.minWorkYear = workYear[0]
                query.maxWorkYear = workYear[1]
            } else {
                query.minWorkYear = ''
                query.maxWorkYear = ''
            }
            if (query.source) {
                switch (query.source) {
                    case '1':
                        query.sysFrom = 2
                        query.bsType = 0
                        break
                    case '2':
                        query.sysFrom = 2
                        query.bsType = 1
                        break
                    case '3':
                        query.sysFrom = 1
                        break

                    default:
                        console.log(111)
                        break
                }
            } else {
                query.sysFrom = ''
                query.bsType = ''
            }
            if (this.components) {
                if (!query.state) {
                    query.state = 0
                }
            }
            const checkedData = this.checkedData
            if (checkedData.length > 0) {
                const arr = []
                checkedData.forEach((i) => {
                    arr.push(i.dataId)
                })
                query.dataId = arr.join(',')
            }

            if (this.components) {
                if (!query.state) {
                    query.state = 0
                }
                candidateList(query).then((res) => {
                    this.list = res.result.records
                    console.log(this.list)
                    this.total = res.result.total
                    this.listLoading = false
                    if (this.list.length == 0) {
                        this.noDateView = true
                    } else {
                        this.list.forEach(i => {
                            this.checkboxData.push(i.dataId)
                        })
                        this.noDateView = false
                    }
                })
            } else {
                userList(query).then((res) => {
                    this.list = res.result.records
                    this.total = res.result.total
                    this.listLoading = false
                    if (this.list.length == 0) {
                        this.noDateView = true
                    } else {
                        this.list.forEach(i => {
                            this.checkboxData.push(i.dataId)
                        })
                        this.noDateView = false
                    }
                })
            }
        },
        selectedForwardDrawerOpen() {
            const checkedData = this.checkedData
            if (checkedData.length > 1) {
                this.$message.error('不可同时转发多份简历')
            } else if (checkedData.length < 1) {
                this.$message.error('请选择一份要转发的简历')
            } else {
                this.forwardDrawerOpen(checkedData[0])
            }
        },
        // 打开转发简历弹窗
        forwardDrawerOpen(item) {
            this.$refs.forwardDrawer.show(item.userInfo.name, item.jobName, item.reId, item.jobId)
        },
        // 打开不合适原因弹窗
        improperDrawerOpen(item) {
            this.$refs.improperDrawer.show(item.userInfo.name, item.dataId, item.jobName)
        },
        // 打开录用弹窗
        employDrawerOpen(item) {
            this.$refs.employDrawer.show(item.userInfo.name, item.userInfo.userId, item.jobId, item.comId, item.dataId, item.jobName)
        },
        // 打开面试反馈结果
        interviewResultsOpen(item) {
            if (item.opInterviewHistory.length > 0) {
                this.$refs.interviewResultsDrawer.show(item.opInterviewHistory[0].id, item.userInfo.userId, item.dataId)
            } else {
                this.$message({
                    message: '请先邀约面试',
                    type: 'warning'
                })
            }
        },
        // 打开面试原因弹窗
        interviewrDrawerOpen(item) {
            this.$refs.interviewDrawer.show(item.userInfo.name, item.userInfo.userId, item.jobName, item.jobId, item.comId, item.reId, item.dataId)
        }
    }
}
</script>
<style lang="scss" scoped>
.container-personnel {

    .table-top-group {
        background: #fff;
        padding: 13px 20px;
    }

    .list {
        .box-item {
            margin-bottom: 27px;

            .type-tag-view {
                position: relative;
            }

            .upper {
                font-size: 12px;
                font-weight: 400;
                line-height: 16px;
                color: #999999;
                margin-left: 20px;
                margin-bottom: 12px;

                span {
                    margin-right: 13px;
                }
            }

            .type-tag {
                position: absolute;
                top: 0;
                left: 20px;

                .el-tag {
                    border-radius: 0;
                    border-bottom-right-radius: 8px;
                }
            }

            .lower {

                position: relative;

                .photo {
                    position: absolute;
                    top: 0;
                    left: 0;
                }

                .info-box {
                    margin-left: 70px !important;
                    display: flex;
                    align-items: center;
                }

                .basic-info {
                    .name {
                        font-size: 16px;
                        font-weight: bold;
                        color: #333333;
                    }

                    .introduce {
                        margin: 10px 0;
                        font-size: 14px;
                        font-weight: 400;
                        color: #919191;

                        span {
                            margin-right: 10px;
                            border-right: 1px solid #e8e8e8;
                            padding-right: 10px;
                        }

                        span:last-child {
                            border: none;
                        }
                    }

                    .expect {
                        font-size: 14px;
                        font-weight: 400;
                        color: #333333;
                        position: relative;

                        .expect-title {
                            width: 50px;
                            position: absolute;
                            top: 0;
                            bottom: 0;
                        }

                        .expect-box {
                            margin-left: 50px;

                            .expect-item {
                                width: 100%;

                                span {
                                    margin-right: 10px;
                                    border-right: 1px solid #e8e8e8;
                                    padding-right: 10px;
                                }

                                span:last-child {
                                    border: none;
                                }
                            }
                        }

                    }
                }

                .history-info {
                    .work,
                    .education {
                        position: relative;

                        .icon {
                            width: 18px;
                            height: 18px;
                            background: #ebf3fc;
                            border-radius: 50%;
                            font-size: 8px;
                            color: #348ce8;
                            text-align: center;
                            line-height: 18px;
                            position: absolute;
                            top: 0;
                            left: 0;
                        }

                        .item {
                            margin-left: 20px;
                            line-height: 18px;
                            position: relative;
                            font-size: 12px;
                            font-weight: 400;

                            color: #666666;

                            .date {
                                font-size: 12px;
                                font-weight: 400;
                                color: #cccccc;
                                margin-right: 12px;
                                width: 100px;
                                position: absolute;
                                top: 0;
                                left: 0;
                            }

                            .company-item {
                                padding-left: 100px;
                                font-size: 12px;
                                font-weight: 400;
                                color: #666666;
                                white-space: nowrap;
                                overflow: hidden;
                                text-overflow: ellipsis;
                                width: 100%;

                                span {
                                    margin-right: 10px;
                                    border-right: 1px solid #e8e8e8;
                                    padding-right: 10px;
                                }

                                span:last-child {
                                    border: none;
                                    margin-right: 0;
                                    padding-right: 0;
                                }
                            }

                        }

                    }
                }

                .button-group {
                    text-align: right;
                }
            }
        }
    }
}
</style>
